{% extends "panel.html" %}
{% load i18n %}
{% load inventree_extras %}
{% load plugin_extras %}

{% block label %}plugin-{{plugin_key}}{% endblock %}


{% block heading %}
{% trans "Plugin" %}: <em>{{ plugin.human_name }}</em>
{% endblock %}

{% block content %}

<div class="row">
    <div class="col">
        <h4>{% trans "Plugin information" %}</h4>
        <div class='table-responsive'>
        <table class='table table-striped table-condensed'>
            <col width='25'>
            <tr>
                <td></td>
                <td>{% trans "Name" %}</td>
                <td>{{ plugin.human_name }}{% include "clip.html" %}</td>
            </tr>
            <tr>
                <td></td>
                <td>{% trans "Description" %}</td>
                <td>{{ plugin.description }}{% include "clip.html" %}</td>
            </tr>
            <tr>
                <td><span class='fas fa-user'></span></span></td>
                <td>{% trans "Author" %}</td>
                <td>{{ plugin.author }}{% include "clip.html" %}</td>
            </tr>
            <tr>
                <td><span class='fas fa-calendar-alt'></span></td>
                <td>{% trans "Date" %}</td>
                <td>{% render_date plugin.pub_date %}{% include "clip.html" %}</td>
            </tr>
            <tr>
                <td><span class='fas fa-hashtag'></span></td>
                <td>{% trans "Version" %}</td>
                <td>
                    {% if plugin.version %}
                        {{ plugin.version }}{% include "clip.html" %}
                    {% else %}
                        {% trans 'no version information supplied' %}
                    {% endif %}
                </td>
            </tr>
            {% if plugin.website %}
            <tr>
                <td><span class='fas fa-globe'></span></td>
                <td>{% trans "Website" %}</td>
                <td>{{ plugin.website }}{% include "clip.html" %}</td>
            </tr>
            {% endif %}
            {% if plugin.license %}
            <tr>
                <td><span class='fas fa-balance-scale'></span></td>
                <td>{% trans "License" %}</td>
                <td>{{ plugin.license }}{% include "clip.html" %}</td>
            </tr>
            {% endif %}
        </table>
        </div>

        {% if plugin.is_package == False %}
        <div class='alert alert-block alert-info'>
            {% trans 'The code information is pulled from the latest git commit for this plugin. It might not reflect official version numbers or information but the actual code running.' %}
        </div>

        {% endif %}
    </div>
    <div class="col">
        <h4>{% trans "Package information" %}</h4>
        <div class='table-responsive'>
        <table class='table table-striped table-condensed'>
            <col width='25'>
            <tr>
                <td></td>
                <td>{% trans "Installation method" %}</td>
                <td>
                    {% if plugin.is_package %}
                    {% trans "This plugin was installed as a package" %}
                    {% else %}
                    {% trans "This plugin was found in a local server path" %}
                    {% endif %}
                </td>
            </tr>
            <tr>
                <td><span class='fas fa-sitemap'></span></td>
                <td>{% trans "Installation path" %}</td>
                <td>{{ plugin.package_path }}</td>
            </tr>
            {% if plugin.is_package %}
            {% elif plugin.is_builtin %}
            <tr>
                <td><span class='fas fa-check-circle icon-green'></span></td>
                <td>{% trans "Builtin" %}</td>
                <td>{% trans "This is a builtin plugin which cannot be disabled" %}</td>
            </tr>
            {% else %}
            <tr>
                <td><span class='fas fa-user'></span></td>
                <td>{% trans "Commit Author" %}</td><td>{{ plugin.package.author }} - {{ plugin.package.mail }}{% include "clip.html" %}</td>
            </tr>
            <tr>
                <td><span class='fas fa-calendar-alt'></span></td>
                <td>{% trans "Commit Date" %}</td><td>{% render_date plugin.package.date %}{% include "clip.html" %}</td>
            </tr>
            <tr>
                <td><span class='fas fa-code-branch'></span></td>
                <td>{% trans "Commit Hash" %}</td><td>{{ plugin.package.hash }}{% include "clip.html" %}</td>
            </tr>
            <tr>
                <td><span class='fas fa-envelope'></span></td>
                <td>{% trans "Commit Message" %}</td><td>{{ plugin.package.message }}{% include "clip.html" %}</td>
            </tr>
            {% endif %}

            {% settings_value "PLUGIN_CHECK_SIGNATURES" as signatures %}
            {% if signatures %}
            <tr>
                <td><span class='text-{{plugin.sign_color}} fas fa-check'></span></td>
                <td>{% trans "Sign Status" %}</td>
                <td class="bg-{{plugin.sign_color}}">{% if plugin.package.verified %}{{ plugin.package.verified }}: {% endif%}{{ plugin.sign_state.msg }}</td>
            </tr>
            <tr>
                <td><span class='text-{{plugin.sign_color}} fas fa-key'></span></td>
                <td>{% trans "Sign Key" %}</td>
                <td class="bg-{{plugin.sign_color}}">{{ plugin.package.key }}{% include "clip.html" %}</td>
            </tr>
            {% endif %}
        </table>
        </div>
    </div>
</div>

{% mixin_enabled plugin 'settings' as settings %}
{% if settings %}
    {% include 'InvenTree/settings/mixins/settings.html' %}
{% endif %}

{% mixin_enabled plugin 'urls' as urls %}
{% if urls %}
    {% include 'InvenTree/settings/mixins/urls.html' %}
{% endif %}

{% include 'InvenTree/settings/mixins/settings_content.html' %}

{% endblock %}
